var nowDate = getDay(0);
var pandianid = GetQueryString('pandianid');
var shopcode = sessionStorage.getItem("shopcode");
var userId = sessionStorage.getItem("userId");

$(document).ready(function(){  //界面切换
	$('#name').text(sessionStorage.getItem("name"));
	$('#shopname').text(sessionStorage.getItem("shopname"));
 	if(sessionStorage.getItem("Creload")=='true'){
	     window.location.reload();
		 sessionStorage.setItem("Creload", false);
	}else{
		getPandianJindu();
		
  }
	
});
//查询门店盘点进度信息
function getPandianJindu(){
	var sendData = {};
	sendData.pandianid=pandianid;
	$.ajax({
		url: "../pandianevery/getPandianJindu"
		,type:'post'
//		,async: false
		,data:JSON.stringify(sendData)
		,contentType: "application/json; charset=utf-8"
		,dataType:'json'
		,success: function(res){
			console.log(res)
			
			if(res.success){
				var resdata = res.data;
				
				$('#dataTable').append('<tr class="thin-border-bottom">'
						+'	<td>门店待办</td>'
						+'	<td style="" class="">'+resdata.pandiandaibanDate+'</td>'
						+'	<td style="" class="">'+resdata.pandiandaibanFlagname+'</td>'
						+'</tr>');
				$('#dataTable').append('<tr class="thin-border-bottom">'
						+'	<td>盘点检查</td>'
						+'	<td style="" class="">'+resdata.jianchaDate+'</td>'
						+'	<td style="" class="">'+resdata.jianchaFlagname+'</td>'
						+'</tr>');
				$('#dataTable').append('<tr class="thin-border-bottom">'
						+'	<td>盘点审批</td>'
						+'	<td style="" class="">'+resdata.querenDate+'</td>'
						+'	<td style="" class="">'+resdata.querenFlagname+'</td>'
						+'</tr>');
				$('#dataTable').append('<tr class="thin-border-bottom">'
						+'	<td>盘点总结</td>'
						+'	<td style="" class="">'+resdata.zongjieDate+'</td>'
						+'	<td style="" class="">'+resdata.zongjieFlagname+'</td>'
						+'</tr>');
				$('#dataTable').append('<tr class="thin-border-bottom">'
						+'	<td>问题回复</td>'
						+'	<td style="" class="">'+resdata.fankuiDate+'</td>'
						+'	<td style="" class="">'+resdata.fankuiFlagname+'</td>'
						+'</tr>');
				$('#dataTable').append('<tr class="thin-border-bottom">'
						+'	<td>盘点回复</td>'
						+'	<td style="" class="">'+resdata.huifuDate+'</td>'
						+'	<td style="" class="">'+resdata.huifuFlagname+'</td>'
						+'</tr>');
				$('#dataTable').append('<tr class="thin-border-bottom">'
						+'	<td>门店评价</td>'
						+'	<td style="" class="">'+resdata.pingjiaDate+'</td>'
						+'	<td style="" class="">'+resdata.pingjiaFlagname+'</td>'
						+'</tr>');
				$('#dataTable').append('<tr class="thin-border-bottom">'
						+'	<td>结束</td>'
						+'	<td style="" class=""></td>'
						+'</tr>');
			}else{
//				layer.alert(res.message);
			}
		}
		,error:function(XMLHttpRequest, textStatus, errorThrown) {
			 console.log(XMLHttpRequest);
			 console.log(textStatus);
			 console.log(errorThrown);
			 hideloading();
		}
	});
	
}

//跳转到评价页面
function inPingjia(pingjiaFlag){
	window.location.href='toJiancha_pingjia?pandianid='+pandianid+"&pingjiaFlag="+pingjiaFlag;
}